package com.lanyou.esb.redis.proxy.impl;

import org.springframework.stereotype.Service;

import com.lanyou.esb.common.Constants4Redis;
import com.lanyou.esb.redis.proxy.base.BaseStrJedisProxy;
import com.lanyou.esb.redis.vo.IfAlarmVo;

/**
 * 接口告警Redis操作代理
 * 
 * @author Davey.wu
 */
@Service
public class IfAlarmJedisProxy extends BaseStrJedisProxy<IfAlarmVo> {

	public IfAlarmJedisProxy() {
		this.setTimeOut(Constants4Redis.REDIS_TIMEOUT_IF_ALARM);
	}

	@Override
	public String generateKeyFromObject(IfAlarmVo target) {
		/**
		 * 1，目标系统编码相同；<br>
		 * 2，接口编码相同；<br>
		 * 3，接口版本相同；<br>
		 * 4，调用方系统编码相同；<br>
		 * 5，告警类型相同；<br>
		 * 6，告警等级相同；<br>
		 **/
		StringBuilder builder = new StringBuilder();
		builder.append(target.getSystemCode());
		builder.append(KEY_SEPARATOR);
		builder.append(target.getIfCode());
		builder.append(KEY_SEPARATOR);
		builder.append(target.getIfVersion());
		builder.append(KEY_SEPARATOR);
		builder.append(target.getCallSystemCode());
		builder.append(KEY_SEPARATOR);
		builder.append(target.getAlarmType());
		builder.append(KEY_SEPARATOR);
		builder.append(target.getAlarmLevel());
		return builder.toString();
	}
}
